static class Combination {
    	int[] bits;
    	private static int ONE = 0;
    	private static int ZERO = 1;
    	
    	
    	Combination(int len) {
    		bits = new int[len];
    		Arrays.fill(bits, ZERO);
    	}
    	
    	private int bit(int i) {
    		if (i > -1 &&  i < bits.length) {
    			return bits[i];
    		}
    		else if (i == -1){
    			return ZERO;
    		}
    		else {
    			return ONE;
    		}
    	}
    	
    	boolean next(){
    		if (bits.length == 0) {
    			return false;
    		}
    		boolean hasNext = false; 
    		for (int i = bits.length - 1; i > -1; i--) {
    			if (i > 0 &&  i < bits.length - 1) {
    				if (bits[i - 1] == ZERO && bits[i] == ZERO && bits[i + 1] == ONE) {
    					bits[i] = ONE;
    					for (int j = i + 1; j < bits.length; j++) {
    						bits[j] = ZERO;
    					}
    					hasNext = true;
    					break;
    				}
    			}
    			else if (i == bits.length - 1){
    				if (bits[i - 1] == ZERO && bits[i] == ZERO) {
    					bits[i] = ONE;
    					hasNext = true;
    					break;
    				}
    			}
    			else {
    				if (bits[i] == ZERO) {
    					bits[i] = ONE;
    					for (int j = i + 1; j < bits.length; j++) {
    						bits[j] = ZERO;
    					}
    					hasNext = true;
    					break;
    				}
    			}
    		}
    		
    		return hasNext;
    	}
    }
    